package com.guet.ftp.controller;


import com.guet.ftp.entity.User;
import com.guet.ftp.service.DemoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/demoController")
public class DemoController {

    @Autowired
    private DemoService demoService;

    @GetMapping("/getInfo")
    public User getInfo(@RequestParam("id")Integer id){
        User demoModel = demoService.getById(id);
        System.out.println(demoModel);
        return demoModel;
    }

    @PostMapping("/getPostInfo")
    public User getInfo(@RequestBody User user){
        System.out.println(user);
        User demoModel = demoService.getById(user.getId());
        System.out.println(demoModel);
        return demoModel;
    }
}
